def findMax(matrix): # DO NOT modify this line 
    L = len(matrix)
    l = len(matrix[0])
    a = matrix[0][0]
    hang = []
    lie = []
    for i in range(L):
        for j in range(l):
            if matrix[i][j] > a:
                hang.clear()
                lie.clear()
                hang.append(i)
                lie.append(j)
                a = matrix[i][j]
            elif matrix[i][j] == a:
                hang.append(i)
                lie.append(j)
                a = matrix[i][j]
            else:
                continue
    list1 = list(zip(hang,lie))
    list1.sort()
    tuple1 = tuple(list1)
    list2 = [a,tuple1]
    # TODO: add your code here
    return tuple(list2)# You can modify or delete this line

# === DO NOT modify the code below === 
def main():
    n = eval(input())
    matrix = []
    for i in range(n):
        row = [ eval(x) for x in input().split() ]
        matrix.append(row)
    max_value, max_indexes = findMax(matrix)
    print(max_value)
    for item in max_indexes:
        print(item[0],item[1],sep=',')
    
if __name__ == "__main__":
    main()
# === DO NOT modify the code above ===